import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import NoAuthView from "@/views/NoAuthView.vue";
import AccessEnum from "@/access/accessEnum";

export const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "主页",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/MainView.vue"),
    meta: {
      access: AccessEnum.NOT_LOGIN
    }
  }, {
    path: "/managerTeam",
    name: "管理题目",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/ManagerTeamView.vue"),
    meta: {
      access: AccessEnum.ADMIN
    }
  }
  , {
    path: "/addTeam",
    name: "添加题目",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/AddTeamView.vue"),
    meta: {
      access: AccessEnum.UNSHOW
    }
  }, {
    path: "/contest",
    name: "竞赛",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/ContestView.vue"),
    meta: {
      access: AccessEnum.USER
    }
  }, {
    path: "/algorithm_learn",
    name: "学习",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/LearnView.vue"),
    meta: {
      access: AccessEnum.USER
    }
  }, {
    path: "/learn_list",
    name: "学习链表",
    component: () => import("../components/LearnListArr.vue"),
    meta: {
      access: AccessEnum.UNSHOW
    }
  }, {
    path: "/learn_func",
    name: "学习函数执行过程",
    component: () => import("../components/LearnFunc.vue"),
    meta: {
      access: AccessEnum.UNSHOW
    }
  }, {
    path: "/user",
    name: "登录",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/UserLoginView.vue"),
    meta: {
      access: AccessEnum.NOT_LOGIN
    },
    children: [{
      path: "login",
      name: "login",
      component: () => import("../components/UserLogin.vue")
    }, {
      path: "register",
      name: "register",
      component: () => import("../components/UserRegister.vue")
    }]
  }, {
    path: "/noAuth",
    name: "无权限",
    component: NoAuthView,
    meta: {
      access: AccessEnum.UNSHOW
    }
  }, {
    path: "/submit_team",
    name: "提交",
    component: () => import("../views/SubmitTeamView.vue"),
    meta: {
      access: AccessEnum.UNSHOW
    }
  }, {
    path: "/submit_online_contest_team",
    name: "在线竞赛做题页面",
    component: () => import("../views/SubmitOnlineContestTeamView.vue"),
    meta: {
      access: AccessEnum.UNSHOW
    }
  }, {
    path: "/online_contest_team_detail",
    name: "竞赛详情页面(题目列表)",
    component: () => import("../views/OnlineDoContestTeam.vue"),
    meta: {
      access: AccessEnum.UNSHOW
    }
  },{
    path: "/create_team",
    name: "创建",
    component: () => import("../views/CreateTeamView.vue"),
    meta: {
      access: AccessEnum.ADMIN
    }
  }, {
    path: "/submitTeamDetail",
    name: "查看提交题目的详细信息",
    component: () => import("../components/SubmitTeamDetail.vue"),
    meta: {
      access: AccessEnum.UNSHOW
    }
  }, {
    path: "/manage_contest",
    name: "管理竞赛",
    component: () => import("../views/ManageContestView.vue"),
    meta: {
      access: AccessEnum.UNSHOW
    }
  }];
